<script>
  $(function () {
    $("#iCMS-search-box").on('hide.bs.collapse', function () {
        $('[name="q"]',this).val("");
    })
    $(".close","#iCMS-navbar-login").click(function(event) {
      $("#iCMS-navbar-login").hide();
      if(!$("#iCMS-navbar-login").hasClass('affix')){
        iCMS.tip($(".navbar-toggle"),"登录请点击此处","left");
        window.setTimeout(function(){
          $(".navbar-toggle").tooltip('destroy');
        },3000);
      }
    });

  })
</script>
<nav id="header" class="navbar navbar-default" role="navigation" data-spy="affix" data-offset-top="90">
  <div class="container-fluid">
    <div class="navbar-header">
      <a class="navbar-brand" href="<!--{$site.url}-->">
        <img src="<!--{$site.urls.ui}-->/img/iCMS.logo-6.0.png"/>
      </a>
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#iCMS-menu-box">
      <span class="sr-only">Toggle navigation</span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      </button>
      <button type="button" class="search-toggle" data-toggle="collapse" data-target="#iCMS-search-box"><i class="fa fa-search"></i></a></button>
    </div>

    <div class="collapse navbar-collapse" id="iCMS-search-box">
      <form class="navbar-form form-inline" action="<!--{iCMS:router url='/api'}-->" method="get" role="search" target="_blank">
        <input name="app" type="hidden" value="search" />
        <div class="input-group">
          <input type="text" name="q" class="form-control" placeholder="请输入关键词" value="<!--{$search.title}-->">
          <span class="input-group-btn">
            <button type="submit" class="btn btn-primary iCMS_search_btn"><i class="fa fa-search"></i> 搜索</button>
          </span>
        </div>
      </form>
    </div>

    <div class="navbar-collapse" id="iCMS-navbar-login">
      <p class="clearfix info">登录后可以进行顶踩、收藏、评论等为您准备的实用功能</p>
      <a class="btn btn-primary login-btn" href="<!--{iCMS:router url='/api/user/login'}-->"><i class="fa fa-user"></i> 登 录</a>
      <div class="clearfix">
          <a class="reg" href="<!--{iCMS:router url='/api/user/register'}-->"><i class="fa fa-heart"></i> 注册</a>
          <button type="button" class="close">
            <span aria-hidden="true">&times;</span>
            <span class="sr-only">Close</span>
          </button>
      </div>
      <script>
        if (iCMS.user.status()) {
          $("#iCMS-navbar-login").hide();
        }
      </script>
    </div>

  </div>
</nav>
